<template>
  <div class="dt-main-tabs-content">
    <div class="dt-content-main">
      <PmCreatePm v-if="elTab==='0'" />
      <PmCreateOrg v-if="elTab==='1'" />
      <PmCreateNode v-if="elTab==='2'" />
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      uid: this.$tools.getDecrypt(this.$store.state.uid), //用户id
      loading: { mounted: false }
    }
  },
  computed: {
    query() {
      return this.$tools.getQuery(this)
    },
    hashName() {
      return this.$tools.getHashName(this)
    },
    elTab() {
      return this.$tools.getQuery(this).elTab
    }
  },
  methods: {
    getProjectInfo() {
      var data = [
          {
            userId: this.uid,
            projectId: this.query.rootProjectId
          }
        ],
        domain = [this.$store.state.DOMAIN],
        path = ['/project/project/projectInfo'],
        dataAxios = this.$tools.getDataAxios(this, domain, path, data)
      Promise.all(dataAxios)
        .then((response) => {
          this.$tools.callbackAxios(this, response, (response) => {
            var data = response[0].data
            if (data.code === 200) {
              if (data.data.projectState > 0) {
                this.$router.push('/main/#/pm?tab=detail&elTab=0&rootProjectId=' + this.query.rootProjectId)
              }
            } else {
              console.log(data.message, 789)
            }
          })
        })
        .catch((error) => {})
    }
  },
  mounted() {
    if (this.query.rootProjectId) {
      this.getProjectInfo()
    }
  }
}
</script>
<style scoped>
</style>